import request from '@/utils/request'

// 查询店铺订单列表
export function listOrder(query) {
  return request({
    url: '/erp/order/list',
    method: 'get',
    params: query
  })
}

// 查询店铺订单详细
export function getOrder(orderId) {
  return request({
    url: '/erp/order/' + orderId,
    method: 'get'
  })
}

// 新增店铺订单
export function addOrder(data) {
  return request({
    url: '/erp/order',
    method: 'post',
    data: data
  })
}

// 修改店铺订单
export function updateOrder(data) {
  return request({
    url: '/erp/order',
    method: 'put',
    data: data
  })
}

// 删除店铺订单
export function delOrder(orderId) {
  return request({
    url: '/erp/order/' + orderId,
    method: 'delete'
  })
}
//同步订单
export function synchronousOrders(data){
  return request({
    url:'/erp/order/synchronousOrder',
    method:'post',
    data:data
  })
}
//获取最新的同步时间
export  function syncTime(mallId,syncType){
  return request({
    url:'/erp/sync/selectSyncTypeAndMallId/'+mallId+'/'+syncType,
    method:'get',
  })
}
//获取商品详情
export function  getOrderItem(mallId,orderNumber){
  return request({
    url:'/erp/item/getItemDetails/'+mallId+'/'+orderNumber,
    method:'get',
  })
}
//获取面单
export function getFile(data){
  return request({
    url:'/erp/order/printFile',
    method:'post',
    data:data,
  })
}
//获取仓库信息
export function getDepotList(){
  return request({
    url:'/erp/depot/selectByUserName',
    method:'get'
  })
}

//根据仓库获取订阅渠道信息
export function getChannel(depotCode){
  return  request({
    url:'/erp/subscribe/listChannel/'+depotCode,
    method:'get'
  })
}

//批量获取面单
export function getPrintList(data){
  return request({
    url:'/erp/order/printList',
    method:'post',
    data:data
  })
}
//发送订单
export function sendOrders(data){
  return request({
    url:'/erp/send/sendOrder',
    method:'post',
    data:data
  })
}
